//
//  OpAddRessView.m
//  LoveBeeProject
//
//  Created by 沈腾飞 on 2017/1/9.
//  Copyright © 2017年 斯芬克斯. All rights reserved.
//

#import "OpAddRessView.h"
#import "AddressDetailTableViewController.h"

@interface OpAddRessView ()

@end

@implementation OpAddRessView

- (void)viewDidLoad {
    [super viewDidLoad];
    //收货地址控制器
    UITableViewController *tabVC = [[UITableViewController alloc] initWithStyle:UITableViewStyleGrouped];
    [self addChildViewController:tabVC];
    [self.view addSubview:tabVC.view];
    [tabVC.view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.offset(0);
        make.bottom.offset(-60);
    }];
    //尾部视图
    UIView *footView = [[UIView alloc] init];
    footView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:footView];
    [footView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.offset(0);
        make.top.equalTo(tabVC.view.mas_bottom);
    }];
    UIImageView *imgV = [[UIImageView alloc] init];
    imgV.image = [UIImage imageNamed:@"icon_sendcoupon"];
    [footView addSubview:imgV];
    [imgV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.centerY.equalTo(footView);
    }];
    
    UIButton *btn = [[UIButton alloc] init];
    [btn setTitle:@"+新增地址" forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [btn setTitle:@"+新增地址" forState:UIControlStateHighlighted];
    [btn setTitleColor:[UIColor cyanColor] forState:UIControlStateHighlighted];
    [footView addSubview:btn];
    [btn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.centerY.equalTo(imgV);
    }];
    [btn addTarget:self action:@selector(addNewAddress:) forControlEvents:UIControlEventTouchUpInside];
};


//添加地址
-(void)addNewAddress:(UIButton *)btn
{
    AddressDetailTableViewController *detailVC = [[AddressDetailTableViewController alloc] init];
    [self.navigationController pushViewController:detailVC animated:NO];
    NSLog(@"新增地址");
}

@end
